package com.runchinaup.textapp.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import org.jetbrains.annotations.Nullable;

/**
 * Created by liber on 2018/2/28.
 */

/**
 * 简单的画了个圆
 *
 */

public class CircleBar extends View {
    public CircleBar(Context context) {
        super(context);
        init();
    }

    public CircleBar(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public CircleBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    Paint paint = null;

    private void init() {
        paint = new Paint();
        paint.setAntiAlias(true);
        paint.setStyle(Paint.Style.FILL);
        paint.setColor(0xffFEA7CC);
    }



    //画view
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        float radius = getWidth() / 2;
        paint.setStyle(Paint.Style.FILL);
        paint.setColor(0xffFEA7CC);
        canvas.drawCircle(radius, radius, radius, paint);
    }
}
